﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using DoAnOOP.DataAccessLayer;
using System.Data.SqlClient;

namespace DoAnOOP.BussinessLayer
{
    class clsBusLyLichSV
    {
        private DataRow info;
        public clsBusLyLichSV()
        {
            clsLyLichSV clsMyLyLichSV = new clsLyLichSV();
            info = clsMyLyLichSV.GetLyLichSV();
        }
        public string GetMSSV()
        {
            return info["MSSV"].ToString().Trim();
        }
        public string GetHo()
        {
            return info["HO"].ToString().Trim();
        }
        public string GetTen()
        {
            return info["TEN"].ToString().Trim();
        }
        public string GetNoiSinh()
        {
            return info["NOISINH"].ToString().Trim();
        }
        public string GetEmail()
        {
            return info["EMAIL"].ToString().Trim();
        }
        public bool GetGioiTinh()
        {
            if (info["GIOITINH"].ToString() == "Nam")
                return true;
            else
                return false;
        }
        public string GetMaKhoa()
        {
            return info["MAKHOA"].ToString().Trim();
        }
        public DateTime GetNgaySinh()
        {
            DateTime dt = new DateTime();
            string date = info["NGAYSINH"].ToString();
            dt = DateTime.ParseExact(date, frmMain.TimeFormat, null);
            return dt;
        }
        public DateTime GetNgayVaoDoan()
        {
            DateTime dt = new DateTime();
            string date = info["NGAYVAODOAN"].ToString();
            dt = DateTime.ParseExact(date, frmMain.TimeFormat, null);
            return dt;
        }
        public List<string> GetDanhSachKhoa()
        {
            clsLyLichSV clsMyLyLichSV = new clsLyLichSV();
            List<DataRow> dr = new List<DataRow>();
            dr = clsMyLyLichSV.LayDanhSachKhoa();
            List<string> dsk = new List<string>();
            for (int i = 0; i < dr.Count; i++)
            {
                DataRow dtr = dr[i];
                dsk.Add(dtr["MAKHOA"].ToString());
            }
            return dsk;
        }
        public bool Update_Ho(string _Ho)
        {
            clsLyLichSV clsMyLyLichSV = new clsLyLichSV();
            if (_Ho != "")
            {
                bool check = clsMyLyLichSV.UpdateHo(_Ho);
                return check;
            }
            return false;
        }
        public bool Update_Ten(string _Ten)
        {
            clsLyLichSV clsMyLyLichSV = new clsLyLichSV();
            if (_Ten != "")
            {
                bool check = clsMyLyLichSV.UpdateTen(_Ten);
                return check;
            }
            return false;
        }
        public bool Update_NoiSinh(string _NoiSinh)
        {
            clsLyLichSV clsMyLyLichSV = new clsLyLichSV();
            if (_NoiSinh != "")
            {
                bool check = clsMyLyLichSV.UpdateNoiSinh(_NoiSinh);
                return check;
            }
            return false;
        }
        public bool Update_Email(string _Email)
        {
            clsLyLichSV clsMyLyLichSV = new clsLyLichSV();
            if (_Email != "")
            {
                bool check = clsMyLyLichSV.UpdateEmail(_Email);
                return check;
            }
            return false;
        }
        public bool Update_NgayVaoDoan(string _nvdoan)
        {
            clsLyLichSV clsMyLyLichSV = new clsLyLichSV();
            if (_nvdoan != "")
            {
                bool check = clsMyLyLichSV.UpdateNgayVaoDoan(_nvdoan);
                return check;
            }
            return false;
        }
        public bool Update_MaKhoa(string _MaKhoa)
        {

            clsLyLichSV clsMyLyLichSV = new clsLyLichSV();
            if (_MaKhoa != "")
            {
                bool check = clsMyLyLichSV.UpdateKhoa(_MaKhoa);
                return check;
            }
            return false;
        }
        public bool Update_GioiTinh(string _GioiTinh)
        {
            clsLyLichSV clsMyLyLichSV = new clsLyLichSV();
            if (_GioiTinh != "")
            {
                bool check = clsMyLyLichSV.UpdateGioiTinh(_GioiTinh);
                return check;
            }
            return false;
        }
        public bool Update_NgaySinh(string _NgaySinh)
        {

            clsLyLichSV clsMyLyLichSV = new clsLyLichSV();
            if (_NgaySinh != "")
            {
                bool check = clsMyLyLichSV.UpdateNgaySinh(_NgaySinh);
                return check;
            }
            return false;
        }
    }
}
